﻿
using System;
namespace LabChecker.Models.Programs
{
    public abstract class Program : IDisposable
    {
        public Program(string code)
        {
            _code = code;
        }

        private string _code;

        private bool _disposed;

        public string Code
        {
            get { return _code; }
        }

        public abstract CompilationResultBase Compile();

        public abstract string Run(string input);

        public abstract void CleanUp();

        public void Dispose()
        {
            if (!_disposed)
            {
                CleanUp();
                _disposed = true;
            }
        }
    }
}
